home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d8 / thelp.arc / THELP2.SLT < prev   
Text File  |  1991-05-03  |  2KB  |  66 lines

  1. //  This demonstrates a help screen that only covers part of the screen
  2.  
  3. //  IMPORTANT:  If you change the number of lines, buf[] should reflect this.
  4. //  Never use more than 24 lines since that is all that can display on Telix.
  5. //  buf[] should be set to (160 * number of lines) to allow enough space to
  6. //  store the char and attribute.
  7.  
  8. //  IMPORTANT:  Variables remarked *** means changed from full screen
  9. //  and will probably need changing if you change the size
  10.  
  11. str buf[2560];    //  ***  array to store screen in - 16 lines by 160 per
  12.                   //       line including char and attribute
  13.  
  14. main()
  15.  
  16. {
  17.    int f,x,cx,cy;
  18.    str s[100];
  19.  
  20.    str fname[67] = "cis2.hlp";  // name of help screen file
  21.    // if you include the full-path name, you will be able to access this
  22.    // from any directory
  23.  
  24.    int color = 79;   // change this to suit your tastes
  25.    int c=7;   //  column position to start             *** from full screen
  26.    int r=1;   //  row position to start                *** from full screen
  27.  
  28.    int lines=16;  //  number of lines of text in file  *** from full screen
  29.  
  30.    cy = gety();      //     get current cursor position (x and y)
  31.    cx = getx();
  32.    cursor_onoff(0);  //     turn cursor off
  33.  
  34.    for (x=r;x<lines+r;x = x + 1)       // save screen into array
  35.       vgetchrsa(0, x, buf,(x*160), 80);  // saves whole row into array
  36.  
  37.    x = r;
  38.    f = fopen(fname, "r");   // open file name to put on screen
  39.    if (ferror(f))
  40.    {
  41.       prints("Error opening file for reading ( File should be in Telix DIR )" );
  42.       // include the full path name to avoid this error
  43.    }
  44.    else
  45.    {
  46.       while (1)         // displays contents of text file
  47.       {
  48.          fgets(s, 100, f);
  49.          if( feof(f) )
  50.              break;
  51.          pstraxy( s, c, x, color);
  52.          x = x + 1;
  53.       }
  54.    }
  55.    fclose(f);
  56.  
  57.    x = inkeyw();  //   if key = Esc, restore screen, otherwise leave
  58.    if (x == 27)  //     help screen intact while in terminal mode
  59.        for (x=r;x<lines+r;x = x + 1)
  60.            vputchrsa( 0, x, buf, (x*160), 80 );
  61.  
  62.    cursor_onoff(1);  // turn cursor back on
  63.    gotoxy(cx,cy);    // restore cursor to its postion
  64. }
  65.  
  66.